<template>
    <a-button :type="type" size="small" @click="handleClick" :disabled="disabled" :loading="loading">
        <template #icon><i :class="['iconfont',icon]"></i></template>
        <span v-if="!loading" class="ml-p5">{{ msg }}</span>
    </a-button>
</template>

<script>
    export default {
        name: "LoadingButton",
        props: {
            msg: String,
            loading: {
                type: Boolean,
                default: false
            },
            disabled: {
                type: Boolean,
                default: false
            },
            icon: {
                type: String,
                default: "icon-search"
            },
            type: {
                type: String,
                default: "primary"
            },
            block: {
                type: Boolean,
                default: false
            },
            size: {
                type: String,
                default: "small"
            }

        },
        methods: {
            handleClick() {
                if (!this.loading) {
                    this.$emit("confirm");
                }
            }
        }

    }
</script>

<style scoped>

</style>